package com.action.sale;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dao.SaleOrderDAO;
import com.dao.impl.SaleOrderDAOImpl;


public class SelectSaleOrderServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		String page = request.getParameter("page");
		String rows = request.getParameter("rows");
		String key = request.getParameter("key");
		String type = request.getParameter("type");
		String sort = request.getParameter("sort");
		String order = request.getParameter("order");
		int startPage = Integer.parseInt(page);
		int endRows = Integer.parseInt(rows);
		SaleOrderDAO sod = new SaleOrderDAOImpl();
		response.setCharacterEncoding("UTF-8");
		response.getWriter()
				.print(sod.selectSaleOrder(key, type, startPage, endRows, sort,
						order));
		response.getWriter().flush();
	}

}
